<?php

/*
 * CopyRight  : (C)2012-2099 HaoTeam Inc.
 * Document   : AdminConfigTab.php
 * Created on : 2021-1-31 15:05:32
 * Author     : Tiger <1192851302@qq.com>
 * Description: This is NOT a freeware, use is subject to license terms.
 *              这即使是一个免费软件,使用时也请遵守许可证条款,得到当时人书面许可.
 *              未经书面许可,不得翻版,翻版必究;版权归属 HaoTeam Inc;
 */

namespace app\admin\model;

use think\Model;

/**
 * 系统配置分组
 * Class AdminConfigTab
 * Tiger <1192851302@qq.com> 2021-1-31 15:05:32
 */
class AdminConfigTab extends Model {

    /**
     * 获取数据列表-分页
     * @author Tiger <1192851302@qq.com>
     * @param array $where
     * @return array
     */
    public static function getList($where = []) {
        $model = self::where('is_del', 0);
        if (!empty($where['title'])) {
            $model->where('title', 'LIKE', '%' . $where['title'] . '%');
            unset($where['title']);
        }
        if (input('limit', 0) <= 0) {
            return $model->select()->toArray();
        }
        $models = $model->where($where)->order('id desc')->paginate(input('limit', 10));
        return [
            'code' => 0,
            'items' => $models->items(),
            'total' => $models->total()
        ];
    }

}
